package BookManager.operation;

import BookManager.Book;
import BookManager.BookDao;

import java.util.Scanner;

public class AddOperation implements IOperation {
    @Override
    public void work() {
        Scanner scanner=new Scanner(System.in);

        System.out.println("新增书籍名称");
        String name=scanner.next();

        System.out.println("新增书籍作者");
        String author=scanner.nextLine();

        System.out.println("新增书籍价格");
        int price=scanner.nextInt();

        System.out.println("新增书籍类型");
        String type=scanner.next();

        Book book=new Book();
        book.setName(name);
        book.setAuthor(author);
        book.setPrice(price);
        book.setType(type);
        BookDao bookDao=new BookDao();
        bookDao.add(book);
    }
}
